Skip to content

Conversation

@joshua-adams-1
Copy link
Contributor

@joshua-adams-1 joshua-adams-1 commented Nov 10, 2025

Modifies the SnapshotShutdownProgressTracker to only log the periodic progress report while there are still snapshots left to process. This removes the existing behaviour where the report will log indefinitely, even once all snapshots are completed or paused.

Closes: ES-12794

Modifies the SnapshotShutdownProgressTracker to only log the periodic
progress report when there are still snapshots left to process. This
removes the existing behaviour where the report will log indefinitely,
even once all snapshots are completed or paused.

Closes: ES-12794
// Simulate starting shutdown -- should reset the completion stats and start logging
// Register each snapshot as in progress
for (int i = 0; i < 5; ++i) {
tracker.incNumberOfShardSnapshotsInProgress(dummyShardId, dummySnapshot);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mimics production behaviour where snapshots are added to the tracker prior to the node shutting down. If I didn't, when calling tracker.onClusterStateAddShutdown(); the periodic logger would begin and then immediately end since there would be no in-progress snapshots

@joshua-adams-1 joshua-adams-1 self-assigned this Nov 10, 2025
@joshua-adams-1 joshua-adams-1 marked this pull request as ready for review November 10, 2025 15:50
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Nov 10, 2025
@DiannaHohensee DiannaHohensee added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Coordination Meta label for Distributed Coordination team labels Nov 11, 2025
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Nov 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

Copy link
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few nits, but superficial stuff.

Comments are great to have, but they should explain why something is happening, not only say what’s happening. ‘What’ can generally be understood with some effort from reading the code, but ‘why’ is the difficult part for new readers to grasp. I’d use ‘what’ comments for high level what’s happening in a section of code, when there's a series of steps. But having the ‘what’ without a clear ‘why’ is often frustrating for a reader. E.g., “I wrote this thing and this is what it does, but for the life of me I can’t remember why I wrote it to do that thing”, becomes a problem.

@joshua-adams-1
Copy link
Contributor Author

Hey, thank you for reviewing. I've updated in line with the comments, let me know if there's anything else you want me to clarify / improve

Copy link
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants